package com.hboxs.asl.wechat.dao.impl;

import com.hboxs.asl.dao.impl.BaseDaoImpl;
import com.hboxs.asl.wechat.dao.WxOrderDao;
import com.hboxs.asl.wechat.entity.WxOrder;
import org.springframework.stereotype.Repository;

import javax.persistence.Query;
import java.util.List;

/**
 * Created by hboxs on 18/8/15.
 */
@Repository("wxOrderDaoImpl")
public class WxOrderDaoImpl extends BaseDaoImpl<WxOrder, Long> implements WxOrderDao {

    public List<WxOrder> listWxOrder(String orderType) {

        String queryStr = "SELECT wxOrder " +
                "FROM WxOrder as wxOrder " +
                "WHERE wxOrder.attach=:attach " +
                "ORDER BY wxOrder.createDate DESC";
        Query query = entityManager.createQuery(queryStr).setParameter("attach", orderType);
        return query.getResultList();

    }
}
